package com.mew.common.entity.user;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.mew.common.util.NumberUtil;
import lombok.*;


@TableName("u_profile")
@Data
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Profile{

    private static final long serialVersionUID = 1L;

    @TableId("user_id")
    private Long userId;
    @TableField("vip_level")
    private Integer vipLevel;
    /**
     * 等级
     */
    @TableField("user_level")
    private Integer userLevel;

    @TableField("exp_value")
    private Long expValue;

    @TableField("vip_exp_value")
    private Long vipExpValue;

    /**
     * 0
     */
    @TableField("gold_number")
    private Long goldNumber;
    @TableField("jewel_number")
    private Long jewelNumber;


    /**
     * 押注次数 [控制中心设置不记录则不记录]
     */
    @TableField("play_total")
    private Long playTotal;
    /**
     * 押注金额 [控制中心设置不记录则不记录]
     */
    @TableField("bet_total")
    private Long betTotal;
    /**
     * 总赔付 [控制中心设置不记录则不记录]
     */
    @TableField("payment_total")
    private Long paymentTotal;



    public void initData(){
        this.vipLevel = 0;
        this.userLevel = 1;
        this.jewelNumber = 0L;
        this.expValue = 0L;
        this.vipExpValue = 0L;
        this.playTotal = 0L;
        this.betTotal = 0L;
        this.paymentTotal = 0L;
    }

    /**
     * 返奖率  1000
     * @return
     */
    public int award(){
        return NumberUtil.proportion(this.getPaymentTotal(), this.getBetTotal(), 1000);
    }


}
